package com.ruoyi.web.money.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.MoneyFundTemperature;
import com.ruoyi.web.money.service.IMoneyFundTemperatureService;

/**
 * 长投温度Controller
 * 
 * @author ruoyi
 * @date 2021-03-14
 */
@RestController
@RequestMapping("/money/temperature")
public class MoneyFundTemperatureController extends BaseController
{
    @Autowired
    private IMoneyFundTemperatureService moneyFundTemperatureService;

    /**
     * 查询长投温度列表
     */
    @PreAuthorize("@ss.hasPermi('money:temperature:list')")
    @GetMapping("/list")
    public TableDataInfo list(MoneyFundTemperature moneyFundTemperature)
    {
        startPage();
        List<MoneyFundTemperature> list = moneyFundTemperatureService.selectMoneyFundTemperatureList(moneyFundTemperature);
        return getDataTable(list);
    }

    /**
     * 导出长投温度列表
     */
    @PreAuthorize("@ss.hasPermi('money:temperature:export')")
    @Log(title = "长投温度", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(MoneyFundTemperature moneyFundTemperature)
    {
        List<MoneyFundTemperature> list = moneyFundTemperatureService.selectMoneyFundTemperatureList(moneyFundTemperature);
        ExcelUtil<MoneyFundTemperature> util = new ExcelUtil<MoneyFundTemperature>(MoneyFundTemperature.class);
        return util.exportExcel(list, "temperature");
    }

    /**
     * 获取长投温度详细信息
     */
    @PreAuthorize("@ss.hasPermi('money:temperature:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(moneyFundTemperatureService.selectMoneyFundTemperatureById(id));
    }

    /**
     * 新增长投温度
     */
    @PreAuthorize("@ss.hasPermi('money:temperature:add')")
    @Log(title = "长投温度", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MoneyFundTemperature moneyFundTemperature)
    {
        return toAjax(moneyFundTemperatureService.insertMoneyFundTemperature(moneyFundTemperature));
    }

    /**
     * 修改长投温度
     */
    @PreAuthorize("@ss.hasPermi('money:temperature:edit')")
    @Log(title = "长投温度", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MoneyFundTemperature moneyFundTemperature)
    {
        return toAjax(moneyFundTemperatureService.updateMoneyFundTemperature(moneyFundTemperature));
    }

    /**
     * 删除长投温度
     */
    @PreAuthorize("@ss.hasPermi('money:temperature:remove')")
    @Log(title = "长投温度", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(moneyFundTemperatureService.deleteMoneyFundTemperatureByIds(ids));
    }
}
